package com.health.mapp.impl;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.health.db.service.user.IStuffListService;
import com.health.mapp.bean.Header;
import com.health.mapp.bean.QueryRegisterDoctorListReq;
import com.health.mapp.bean.QueryRegisterDoctorListResp;
import com.health.mapp.utils.DateUtils;
import com.health.mapp.utils.Response;
import com.health.mapp.utils.ResultCode;

/**
 * 获取科室出诊医生
 * @author yuchong
 */
public class QueryRegisterDoctorListImpl implements ActionInterface{

	@Autowired
	IStuffListService stuffListService;
    
    private static Logger logger = Logger.getLogger(QueryRegisterDoctorListImpl.class);

    @Override
    public Response execute(Header header, Object reqBean) throws Exception {


    	QueryRegisterDoctorListReq req = (QueryRegisterDoctorListReq) reqBean;
    	QueryRegisterDoctorListResp _resp = new QueryRegisterDoctorListResp();
    	
    	String registerDate=req.getRegisterDate();

    	if (StringUtils.isEmpty(req.getRegisterDate())) {
    		registerDate = DateUtils.currentDate();
		}
    	
    	if (StringUtils.isNotEmpty(req.getDepartmentId())) {
    		
    		logger.info("DepartmentId:"+req.getDepartmentId());
    		_resp= stuffListService.selectDateStuffSchedule(registerDate,Integer.valueOf(req.getDepartmentId()));
    		
    		_resp.setErrorCode(ResultCode.OPERATION_SUCCESS);
    		_resp.setErrorMsg(ResultCode.OPERATION_SUCCESS_NOTE);
			
		}else{
			
			_resp.setErrorCode(ResultCode.OPERATION_LAKE_PARAMETER_ERROR);
			_resp.setErrorMsg(ResultCode.OPERATION_LAKE_PARAMETER_ERROR_NOTE);
		}
    	_resp.setRegisterDate(registerDate);

        return _resp;
    }


	public IStuffListService getStuffListService() {
		return stuffListService;
	}

	public void setStuffListService(IStuffListService stuffListService) {
		this.stuffListService = stuffListService;
	}


    
    
    
}
